import { useMemo } from "react";
import { NavLink, useLocation } from "react-router-dom";
import routes from "@/zhihuPages";
import { useSearch } from "@/hooks";
export default () => {
  const search = useSearch();
  const id = search.id || 0;
  const arr = useMemo(() => {
    return routes[id].children;
  }, [search]);
  return (
    <div className="nav">
      {arr.map((ele) => (
        <span key={ele.id}>
          <NavLink activeClassName="on" exact to={`${ele.path}?id=${id}`}>
            {ele.text}
          </NavLink>
        </span>
      ))}
    </div>
  );
};
